<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
   <title>佐心，教家长做父母</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="format-detection" content="telephone=no">

    <link rel="stylesheet" href="assets/css/amazeui.min.css">
    <link rel="stylesheet" href="assets/css/style.css?v=2.3">
    <link rel="stylesheet" href="assets/css/index.css?v=2.3">
    <script>
    	    /** 
     * 返回前一页（或关闭本页面） 
     * <li>如果没有前一页历史，则直接关闭当前页面</li> 
     */  
    function goBack(){  
        if ((navigator.userAgent.indexOf('MSIE') >= 0) && (navigator.userAgent.indexOf('Opera') < 0)){ // IE  
            if(history.length > 0){  
                window.history.go( -1 );  
            }else{  
                location.href="${ctx}/index.jsp";
            }  
        }else{ //非IE浏览器  
            if (navigator.userAgent.indexOf('Firefox') >= 0 ||  
                navigator.userAgent.indexOf('Opera') >= 0 ||  
                navigator.userAgent.indexOf('Safari') >= 0 ||  
                navigator.userAgent.indexOf('Chrome') >= 0 ||  
                navigator.userAgent.indexOf('WebKit') >= 0){  
      
                if(window.history.length > 1){  
                    window.history.go( -1 );  
                }else{  
                    location.href="${ctx}/index.jsp";
                }  
            }else{ //未知的浏览器  
                window.history.go( -1 );  
            }  
        }  
    }  
    </script>
</head>
<body class="bg-gray">
<header data-am-widget="header" class="am-header am-header-default am-header-fixed am-border-bottom">
    <div class="am-header-left am-header-nav">
        <a  onclick="goBack();"  >
            <i class="icon_8"></i>
        </a>
    </div>
    <h1 class="am-header-title">
        ${study.studyTitle}
    </h1>

</header>
<section class="am-padding-bottom-sm" id="amz-main" data-tag="css-nav">
    <div class="prelative"><img class="width-100" src="${study.studyUrl}">
      <!--钱-->
    <a href="#" class="btn-13" >
       <div class="icon_25"></div><span class="font-color-13">&yen; ${study.studyPrice}</span>
    </a>
    </div>
    <!--表情-->
    <div class="am-container am-padding-top-xs am-padding-bottom-xs">
        <ul class="am-pagination am-pagination-default" >
            
            <c:if test="${labelList!=null}">
	            <c:forEach items="${labelList}" var="label">
	            	 <li class="am-active ">
                		<a href="#" class="border-radius-5">${label}</a>
            		 </li>
	            </c:forEach>
            </c:if>
        </ul>
    </div>
    <div class="bg-white am-padding-top-sm am-padding-bottom-xs">
        <!-- 培训信息-->
        <div class="icon_26 am-text-center font-color-12 ">
            培训信息
        </div>
        <div class=" bg-gray am-margin-left-sm am-margin-right-sm am-margin-top-sm">
            <div class="am-g   am-padding-top-sm border-1">

                <div class=" am-u-sm-12 am-list-main box am-padding-bottom-sm">
                    <div class="width-60px">
                        <a class="">
                            <img class="img-50" src="${counselor.personHead}"/>
                        </a>
                        <i class="icon_12"></i>
                    </div>
                    <div class="box-1">
                        <div class="am-list-item-hd font-color-13 font-15">
                            <span>主讲：</span><span>${counselor.counseName}</span>
                        </div>

                        <div class="font-15  font-color-13 margin-top-3">
                            <span>培训方向：</span><span>${study.studyDirection}</span>
                        </div>
                    </div>
                </div>
                <div class="am-u-sm-12  font-15 ">
                    <div class="border-tops font-color-13  am-padding-top-sm am-padding-bottom-sm box">
                        <div class="width-60px"><i class="icon_28"></i></div>
                        <div class="box-1"><span>人数上限：</span><span>${study.maxStudent}</span><span class="font-color-16">(已报${study.signStudent})</span>
                        </div>
                    </div>

                </div>
                <div class="am-u-sm-12  font-15 ">
                    <div class="border-tops font-color-13  am-padding-top-sm am-padding-bottom-sm box">
                        <div class="width-60px"><i class="icon_56"></i></div>
                        <div class="box-1"><span>培训地点：</span><span>${study.studyCity}</span><span class="font-color-16"></span>
                        </div>
                    </div>

                </div>
                <div class="am-u-sm-12  font-15">
                    <div class="border-tops font-color-13  am-padding-top-sm am-padding-bottom-sm box">
                        <div class="width-60px"><i class="icon_29"></i></div>
                        <div class="box-1"><span>培训时间：${study.startStudyStr} -- ${study.endStudyStr}</span></div>
                    </div>
                </div>
            </div>
        </div>

        <!-- 培训内容-->
        <div class="icon_26 am-text-center font-color-12 margin-top-15 ">
            培训内容
        </div>
        <div class="am-padding-bottom-sm">
            <div class="am-padding-sm am-margin-top-xs">
                <!-- <img class="width-100" src="${study.contentUrl}"/> -->
            </div>
            <div class="am-container font-color-13 font-14">
                ${study.studyContent}
            </div>
        </div>


        <!--培训评价-->
        <div class="icon_24 am-text-center font-color-15">
            培训评价（共<span id="pingjiaCount">100</span>条评价）
        </div>
        <div class="mark_list">

            <div class="am-list-news am-list-news-default ">

                <div class="am-list-news-bd am-margin-left-sm am-margin-right-sm">
                    <ul class="am-list">
						
                    </ul>
                </div>

            </div>
            <div class="font-color-12 am-text-center am-container" id="allPingjia">
               <div class="border-tops width-100 am-margin-top-xs am-padding-top-xs" onclick="window.location.href='peixunAllPingLun.jsp?studyId=${study.id}'">全部评价</div>
            </div>

            <!--<div class="icon_55"></div>-->
            <!--<div class="am-text-center font-14 font-color-15">暂无评论，快点击评论按钮，抢沙发吧！</div>-->
        </div>
    </div>


</section>

<footer data-am-widget="navbar" class="am-navbar am-cf am-navbar-default bg-white"
        id="">
    <div class="am-g   am-g-collapse am-padding-left-sm">
        <div class="am-u-sm-4 font-color-1 am-padding-right-sm" id="shouchang">
            <div class="btn-4"><span class="prelative"><i <c:if test="${isShouChang==0}">class="icon_48"</c:if> <c:if test="${isShouChang==1}">class="icon_48 cur"</c:if>></i>收藏</span></div>
        </div>
        <div class="am-u-sm-8 am-padding-right-sm">
        	<c:if test="${study.maxStudent==study.signStudent}">
        		<div class="btn-5"><span class="">已报滿</span></div>
        	</c:if>
        	<c:if test="${study.maxStudent!=study.signStudent}">
            <a href="gotoConfirm?id=${study.id}" ><div class="btn-5"><span class="">立即报名</span></div></a>
            </c:if>
        </div>
    </div>

</footer>

<div class="am-modal am-modal-prompt" tabindex="-1" id="my-prompt">
    <div class="am-modal-dialog">
        <div class="am-modal-hd">评论</div>
        <div class="am-modal-bd">
            <textarea rows="3" class="mark_content am-modal-prompt-input">
            </textarea>
        </div>
        <div class="am-modal-footer">
            <span class="am-modal-btn" data-am-modal-cancel>取消</span>
            <span class="am-modal-btn" data-am-modal-confirm>提交</span>
        </div>
    </div>
</div>

<script src="assets/js/jquery.min.js"></script>
<script src="assets/js/amazeui.min.js"></script>
<script>
    $(function () {
    
    	var baseResponse=$.ajax({url:"getPeiPingjia?studyId=${study.id}",async:false});
    	var pingjiaJson=JSON.parse(baseResponse.responseText);
		if(pingjiaJson.resultCode=="0"){
		   var html="";
		   var xunhuancishu=5;
		   if(pingjiaJson.pingjiaList.length<=5){
		   	  xunhuancishu=pingjiaJson.pingjiaList.length;
		   }
		   $("#pingjiaCount").text(pingjiaJson.pingjiaList.length);
		   if(xunhuancishu>0){
		   for(var i=0;i<xunhuancishu;i++){
		   	  html+="<li class='am-g am-list-item-desced am-list-item-thumbed am-list-item-thumb-left'>";
              html+="              <div class=' am-u-sm-12 am-list-main font-14 box'>";
              html+="                  <div class='width-60px'>";
              html+="                      <a class=''>";
              html+="                          <img class='img-50' src='"+pingjiaJson.pingjiaList[i].headUrl+"'/>";
              html+="                      </a>";
              html+="                 </div>";
              html+="                  <div class='box-1 margin-top-5'>";
              html+="                      <h3 class='am-list-item-hd font-color-main'>";
              html+="                          <div class='am-g am-g-collapse'>";
              html+="                              <div class='am-u-sm-8'><span";
              html+="                                      class='font-color-13 font-15 font-bold'>"+pingjiaJson.pingjiaList[i].nickName+"</span>";
              html+="                              </div>";
              html+="                              <div class='am-u-sm-4 font-color-16  padding-top-2pxs am-text-right'>";
              html+=pingjiaJson.pingjiaList[i].pingjiaTime.substr(0,10);
              html+="                              </div>";
              html+="                          </div>";
              html+="                      </h3>";
              html+="                      <div class='font-14 font-color-13 '>";
              html+="                          <span class='am-fl font-color-15'>评分：</span>";
              
              var html2="";
              for(var j=0;j<pingjiaJson.pingjiaList[i].pingjiaxx;j++){
              	  html2+="                          <i class='star-cur'></i>";
              }
              html+=html2;
              html+="                      </div>";
              html+="                  </div>";
              html+="              </div>";
              html+="              <div class=' am-u-sm-12 am-list-main font-14 font-color-15 am-margin-top-xs'>";
              html+=pingjiaJson.pingjiaList[i].pingjia;
              html+="              </div>";
              html+="          </li>";
		   }
		   }else{
		   	  html="<div class='icon_55'></div>";
              html+="<div class='am-text-center font-14 font-color-15'>暂无评论，快点击评论按钮，抢沙发吧！</div>";
              $("#allPingjia").hide();
		   }
		   $(".am-list").html(html);
	   	}
	   	
        $('#btnmark').on('click', function () {
            $('#my-prompt').modal({
                relatedTarget: this,
                onConfirm: function (e) {
                    alert('你输入的是：' + e.data || '')
                },
                onCancel: function (e) {
//                    alert('不想说!');
                }
            });
        });

       $("#shouchang").on('click', function () {
	   		var baseResponse2=$.ajax({url:"goShouchang?picNewsId=${study.id}&type=2",async:false});
		  	var isShouchang=JSON.parse(baseResponse2.responseText);
			if(isShouchang.resultCode=="0"){
			   	if($(this).find("i.icon_48").hasClass("cur")){
                	$(this).find("i.icon_48").removeClass("cur");
	            }else{
	            	$(this).find("i.icon_48").addClass("cur");
	            }
		   	}
        });
       $("#allPingjia").on('click', function () {
	   		var baseResponse=$.ajax({url:"getPeiPingjia?studyId=${study.id}",async:false});
    	var pingjiaJson=JSON.parse(baseResponse.responseText);
		if(pingjiaJson.resultCode=="0"){
		   var html="";
		   if(xunhuancishu>0){
		   for(var i=0;i<pingjiaJson.pingjiaList.length;i++){
		   	  html+="<li class='am-g am-list-item-desced am-list-item-thumbed am-list-item-thumb-left'>";
              html+="              <div class=' am-u-sm-12 am-list-main font-14 box'>";
              html+="                  <div class='width-60px'>";
              html+="                      <a class=''>";
              html+="                          <img class='img-50' src='"+pingjiaJson.pingjiaList[i].headUrl+"'/>";
              html+="                      </a>";
              html+="                 </div>";
              html+="                  <div class='box-1 margin-top-5'>";
              html+="                      <h3 class='am-list-item-hd font-color-main'>";
              html+="                          <div class='am-g am-g-collapse'>";
              html+="                              <div class='am-u-sm-8'><span";
              html+="                                      class='font-color-13 font-15 font-bold'>"+pingjiaJson.pingjiaList[i].nickName+"</span>";
              html+="                              </div>";
              html+="                              <div class='am-u-sm-4 font-color-16  padding-top-2pxs am-text-right'>";
              html+=pingjiaJson.pingjiaList[i].pingjiaTime.substr(0,10);
              html+="                              </div>";
              html+="                          </div>";
              html+="                      </h3>";
              html+="                      <div class='font-14 font-color-13 '>";
              html+="                          <span class='am-fl font-color-15'>评分：</span>";
              
              var html2="";
              for(var j=0;j<pingjiaJson.pingjiaList[i].pingjiaxx;j++){
              	  html2+="                          <i class='star-cur'></i>";
              }
              html+=html2;
              html+="                      </div>";
              html+="                  </div>";
              html+="              </div>";
              html+="              <div class=' am-u-sm-12 am-list-main font-14 font-color-15 am-margin-top-xs'>";
              html+=pingjiaJson.pingjiaList[i].pingjia;
              html+="              </div>";
              html+="          </li>";
		   }
		   }
		   $(".am-list").html(html);
	   	}
        });
    });
</script>
</body>
</html>